package vue;

import gestionSites.Site;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;


/**
 * fen�tre repr�sentant la liste d'emails
 *
 */
public class EmailView extends JFrame {
	

	private static final long serialVersionUID = 1L;

	/**
	 * site selectionn�
	 */
	private Site site;
	
	/**
	 * zone de texte des emails
	 */
	private JTextArea emailArea;
	
	/**
	 * constructeur
	 * @param s site
	 */
	public EmailView(Site s){
		this.setTitle("E-mails from "+s.getName());
		site = s;
		this.setPreferredSize(new Dimension(220,200));
		this.dispose();
        pack();
        this.setVisible(true);
        
        emailArea = new JTextArea();
        emailArea.setEditable(false);
        emailArea.setText(site.getTextEmail());
        
        JScrollPane jScrollPane = new JScrollPane(emailArea);
		jScrollPane.setPreferredSize(new Dimension(220,200));
	    jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
	    jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	    jScrollPane.getViewport().add(emailArea, null);	   
        this.add(jScrollPane);
	}
}
